﻿//Write a program that reads from the console a sequence of N integer numbers and returns the minimal and maximal of them.

using System;

class GetMinAndMaxFromNNumbers
{
    static void Main()
    {
        Console.Write("Enter number count: ");
        int numbersCount = int.Parse(Console.ReadLine());
        int minNumber = 0;
        int maxNumber = 0;
        for (int i = 1; i <= numbersCount; i++)
        {
            Console.Write("Enter number {0}: ", i);
            int number = int.Parse(Console.ReadLine());
            if ((minNumber != number && minNumber > number) || i == 1)
            {
                minNumber = number;
            }
            if ((maxNumber != number && maxNumber < number) || i == 1)
            {
                maxNumber = number;
            }
        }
        Console.WriteLine("Min number = {0}", minNumber);
        Console.WriteLine("Max number = {0}", maxNumber);
    }
}
